package com.pilipili.service;

import com.pilipili.dao.messageMapper;
import com.pilipili.pojo.Message;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.CachePut;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class messageServiceImpl implements messageService{

    @Autowired
    messageMapper messageMapper;
    @Override
    @Cacheable(value = "Message")
    public List<Message> selectMessage(Message message) {
        return messageMapper.selectMessage(message);
    }

    @Override
    @CacheEvict(value="Message", allEntries=true)
    public int deleteMessage(Integer message_id) {
        return messageMapper.deleteMessage(message_id);
    }

    @Override
    @CacheEvict(value="Message", allEntries=true)
    public int insertMessage(Message message) {
        return messageMapper.insertMessage(message);
    }

    @Override
    @CacheEvict(value="Message", allEntries=true)
    public int updateMessage(Message message) {
        return messageMapper.updateMessage(message);
    }
}
